from rest_framework import serializers

from xyz.models import Recruit,Enterprise
class aoligeiseserializer(serializers.ModelSerializer):
    id = serializers.IntegerField()

    # users = serializers.PrimaryKeyRelatedField(read_only=True)

    class Meta:
        model = Enterprise
        exclude = []
class recuRecruitsserializer(serializers.ModelSerializer):
    enterprise = aoligeiseserializer()
    class Meta:
        model = Recruit
        fields = '__all__'

class Enterpriseserializer(serializers.ModelSerializer):
    id = serializers.IntegerField()
    recruits = recuRecruitsserializer(many=True)
    # users = serializers.PrimaryKeyRelatedField(read_only=True)
    class Meta:
        model = Enterprise
        exclude = []

class Recruitsserializer(serializers.ModelSerializer):
    # id = serializers.IntegerField()
    enterprise = Enterpriseserializer()
    class Meta:
        model = Recruit
        fields = '__all__'
class SBiseserializer(serializers.ModelSerializer):
    # id = serializers.IntegerField()
    # recruits = recuRecruitsserializer(many=True)
    # users = serializers.PrimaryKeyRelatedField(read_only=True)
    class Meta:
        model = Enterprise
        depth = 3
        fields = '__all__'